define(["jquery", "swiper", "template"], ($, Swiper, template) => {

    class IndexSwiper{
        constructor(data) {
            this.dataList = data;
            this.init();
        }
        init() {
            // console.log(this.dataBanner);
            // const htmlStr = template("indexSwiperTemplate", {data : this.dataBanner});
            // console.log(htmlStr);
            $(".bannerBox").load("/html/modules/indexSwiper.html", () => {
                // 轮播图数据添加
                // console.log(this.dataList)
                // console.log(this.dataList[0].image[0])
                const htmlStr = template("indexSwiperTemplate", {data : this.dataList});
                // console.log(htmlStr);
                $("#indexSwiperTemplateBox").html(htmlStr);

                //swiper轮播图效果设置
                var swiper = new Swiper(".swiper-container", {
                    spaceBetween: 30,
                    effect: "fade",
                    autoplay: {
                        delay: 2500,
                        disableOnInteraction: false,
                    },
                    pagination: {
                        el: ".swiper-pagination",
                        clickable: true,
                    }
                });

            })
        }

    }
    return IndexSwiper;

});